

// Function Call and Return
// Add 15 and 25 using a function

start:
        addi  x5, x0, 15        // First value
        addi  x6, x0, 25        // Second value

        jal   x1, AddNumbers    // Call function; x1 receives return address

        cout  << "Result = " << x7 << endl;

        jal   x0, End           // Skip over the function

AddNumbers:
        add   x7, x5, x6        // x7 = x5 + x6
        jalr  x0, 0(x1)         // Return to instruction after JAL

End:
